package thread;

public class TestYied implements Runnable {
    @Override
    public void run() {
        if (Thread.currentThread().getName().equals("xm")) {
            Thread.yield();
        }
        System.out.println(Thread.currentThread().getName() + "--------->");
    }
}

class Test {
    public static void main(String[] args) {
        for (int i = 0; i < 5; i++) {
            new Thread(new TestYied(), "xm").start();
            new Thread(new TestYied(), "xh").start();
        }
    }
}
